var e = require;
var t = module;
var o = exports;
var Adv_skd=require("./Adv_skd");
Object.defineProperty(o, "__esModule", {value: !0});
var n = e("NotifyEventType"),
    a = e("GlobalParams"),
    i = e("AudioManager"),
    r = e("ModuleUI"),
    s = e("Game"),
    l = e("UIManager"),
    c = e("sdkConfig"),
    d = e("AD"),
    h = e("signin_node_item"),
    _ = cc._decorator,
    u = _.ccclass,
    p = _.property,
    m = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (t.signin_node = null), (t.signin_view = null), (t.double_btn = null), (t.signin_btn = null), t;
        }
        return (
            __extends(t, e),

            (t.prototype.onDisable = function () {

                Adv_skd.default.instance.hideBannerAd();
                Adv_skd.default.instance.hideGridAdLeft();
                Adv_skd.default.instance.hideGridAdRight();
                Adv_skd.default.instance.hideGridAdTop();
                Adv_skd.default.instance.hideGridAdLeftOne();
                Adv_skd.default.instance.hideGridAdRightOne();
                Adv_skd.default.instance.hideGridAdButtom();

            }),

            (t.prototype.initView = function () {

                Adv_skd.default.instance.hideBannerAd();
                Adv_skd.default.instance.hideGridAdLeft();
                Adv_skd.default.instance.hideGridAdRight();
                Adv_skd.default.instance.hideGridAdTop();
                Adv_skd.default.instance.hideGridAdLeftOne();
                Adv_skd.default.instance.hideGridAdRightOne();
                Adv_skd.default.instance.hideGridAdButtom();
                Adv_skd.default.instance.showGridAdLeft();
                Adv_skd.default.instance.showGridAdRight();
                Adv_skd.default.instance.showGridAdTop();
                Adv_skd.default.instance.showInterstitialAd();

                e.prototype.initView.call(this), this.showSigninViewInfo();
            }),
            (t.prototype.showSigninViewInfo = function () {
                for (var e = 0; e < 7; e++) {
                    var t = null;
                    this.signin_view.children[e]
                        ? (t = this.signin_view.children[e])
                        : ((t = cc.instantiate(this.signin_node)), this.signin_view.addChild(t)),
                        t.getComponent(h.default).showSigninInfo(e),
                        t.on("click", this.OnClick, this),
                        (t.active = !0);
                }
                var o = a.GlobalParams.PlayerSigninInfo.value;
                (this.double_btn.active = o.signin_date != new Date().toLocaleDateString()),
                    (this.double_btn.active = this.double_btn.active && 6 != o.signin_num),
                    (this.signin_btn.active =
                        c.default.platform != c.EPlatform.No_AD && d.default.getInstance().getGameTestVersion()),
                    this.signin_btn.active && (this.signin_btn.active = this.double_btn.active);
            }),
            (t.prototype.OnClick = function (t) {
                var o = this;
                e.prototype.OnClick.call(this, t);
                var r = t.node.name;
                switch (r) {
                    case "close_btn":
                        a.GlobalParams.JoinGuideMode.value &&
                            cc.find("UIManager").getComponent(l.default).showPopup("GuideViewUI"),
                            this.emitEvent(n.default.SEND_BOX_PORTAL_INFO, !0),
                            this.node.destroy();
                        break;
                    case "signin_node":
                    case "signin_btn":
                    case "double_btn":
                        var c = function () {
                            var e = a.GlobalParams.PlayerSigninInfo.value,
                                t = s.default.signin_info[e.signin_num % 7];
                            if (
                                ((t =
                                    e.signin_num % 7 == 6 && 0 != Math.floor(e.signin_num / 7)
                                        ? s.default.signin_info[7]
                                        : t),
                                cc.log(t),
                                1 != t.num)
                            )
                                o.uiManager.addCoinAni(t.num * ("double_btn" == r ? 2 : 1), t.type);
                            else {
                                var i = a.GlobalParams.playerSkinInfo.value;
                                -1 == i.have.hero.indexOf(1)
                                    ? ((i.use[0] = 1),
                                      i.have.hero.push(1),
                                      (a.GlobalParams.playerSkinInfo.value = i),
                                      cc.find("UIManager").getComponent(l.default).showPopup("ObtainHeroTipView"))
                                    : o.uiManager.addCoinAni(700, 1);
                            }
                            e.signin_num++,
                                (e.signin_date = new Date().toLocaleDateString()),
                                (a.GlobalParams.PlayerSigninInfo.value = e),
                                o.emitEvent(n.default.SEND_COCOS_ANALYTICS, {
                                    name: "事件一",
                                    info: "签到天数：" + e.signin_num
                                }),
                                cc.find("UIManager").getComponent(l.default).playerTaskOverInfo(1, 1),
                                o.showSigninViewInfo();
                        };
                        "double_btn" == r
                            ? (d.default.getInstance().showVideo(function (e) {
                                
                                  i.default.playGameBGM(), e == d.ResultEnum.Success && c();
                              }),console.log('双倍领取1'))
                            : c();
                }
            }),
            __decorate([p(cc.Node)], t.prototype, "signin_node", void 0),
            __decorate([p(cc.Node)], t.prototype, "signin_view", void 0),
            __decorate([p(cc.Node)], t.prototype, "double_btn", void 0),
            __decorate([p(cc.Node)], t.prototype, "signin_btn", void 0),
            __decorate([u], t)
        );
    })(r.default);
o.default = m;
